//
//  XFDLogInAPI.m
//  BlocksKit
//
//  Created by 韩冰 on 2017/11/10.
//

#import "XFDLogInNetAPI.h"
#import <XFDCommon/XFDNetManager.h>

@implementation XFDLogInNetAPI

//密码登录
+ (void)loginWithPassWord:(NSMutableDictionary *)dict  WithSuccessBlock:(requestSuccessBlock)success WithFailurBlock:(requestFailureBlock)failure{
    [XFDNetManager netManagerRequestWithMethod:kXMHTTPMethodPOST WithAPI:@"login" WithParams:dict WithSuccessBlock:^(id response) {
        if (success) {
            success(response);
        }
    } WithFailurBlock:^(NSError *error, NSString *tips) {
        if (failure) {
            failure(error,tips);
        }
    }  withHUB:YES];
    
}
//验证码登录
+ (void)loginWithCode:(NSMutableDictionary *)dict  WithSuccessBlock:(requestSuccessBlock)success WithFailurBlock:(requestFailureBlock)failure{
    [XFDNetManager netManagerRequestWithMethod:kXMHTTPMethodPOST WithAPI:@"smslogin" WithParams:dict WithSuccessBlock:^(id response) {
        if (success) {
            success(response);
        }
    } WithFailurBlock:^(NSError *error, NSString *tips) {
        if (failure) {
            failure(error,tips);
        }
    } withHUB:YES];
    
}

//获取验证码
+ (void)getVerificationcode:(NSMutableDictionary *)dict  WithSuccessBlock:(requestSuccessBlock)success WithFailurBlock:(requestFailureBlock)failure{
    [XFDNetManager netManagerRequestWithMethod:kXMHTTPMethodPOST WithAPI:@"verificationcode/getsmscode" WithParams:dict WithSuccessBlock:^(id response) {
        if (success) {
            success(response);
        }
    } WithFailurBlock:^(NSError *error, NSString *tips) {
        if (failure) {
            failure(error,tips);
        }
    }withHUB:YES];
}

//检查验证码
+(void)checksmscode:(NSMutableDictionary *)dict  WithSuccessBlock:(requestSuccessBlock)success WithFailurBlock:(requestFailureBlock)failure{
    [XFDNetManager netManagerRequestWithMethod:kXMHTTPMethodPOST WithAPI:@"verificationcode/verifysmscode" WithParams:dict WithSuccessBlock:^(id response) {
        if (success) {
            success(response);
        }
    } WithFailurBlock:^(NSError *error, NSString *tips) {
        if (failure) {
            failure(error,tips);
        }
    } withHUB:YES];
}

+(void)setRegisterInfo:(NSMutableDictionary *)dict  WithSuccessBlock:(requestSuccessBlock)success WithFailurBlock:(requestFailureBlock)failure{
    [XFDNetManager netManagerRequestWithMethod:kXMHTTPMethodPOST WithAPI:@"user/register" WithParams:dict WithSuccessBlock:^(id response) {
        if (success) {
            success(response);
        }
    } WithFailurBlock:^(NSError *error, NSString *tips) {
        if (failure) {
            failure(error,tips);
        }
    }withHUB:YES];
}
+(void)findThePassWordInfo:(NSMutableDictionary *)dict  WithSuccessBlock:(requestSuccessBlock)success WithFailurBlock:(requestFailureBlock)failure{
    [XFDNetManager netManagerRequestWithMethod:kXMHTTPMethodPOST WithAPI:@"user/resetpassword" WithParams:dict WithSuccessBlock:^(id response) {
        if (success) {
            success(response);
        }
    } WithFailurBlock:^(NSError *error, NSString *tips) {
        if (failure) {
            failure(error,tips);
        }
    }withHUB:YES];
    
}
@end
